﻿using IRepositoryBll;
using IRepositoryDal;
using RepositoryEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RepositoryBll
{
    /// <summary>
    /// 角色业务访问层
    /// </summary>
    public class RoleInfoBll : IRoleInfoBll
    {
        private IRoleInfoDal _roleInfoDal;

        public RoleInfoBll(IRoleInfoDal roleInfoDal)
        {
            _roleInfoDal = roleInfoDal;
        }

        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="roleInfo"></param>
        /// <returns></returns>
        public bool AddRoleInfo(RoleInfo roleInfo)
        {
            //RoleInfoDal roleInfoDal = new RoleInfoDal();
            return _roleInfoDal.Add(roleInfo);
        }

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="roleInfoId"></param>
        /// <returns></returns>
        public bool DeleteRoleInfo(string roleInfoId)
        {
            return _roleInfoDal.Delete(roleInfoId);
        }

        /// <summary>
        /// 根据id获取角色
        /// </summary>
        /// <param name="roleInfoId"></param>
        /// <returns></returns>
        public RoleInfo GetRoleInfo(string roleInfoId)
        {
            return _roleInfoDal.GetRoleInfo(roleInfoId);
        }

        /// <summary>
        /// 更新角色
        /// </summary>
        /// <param name="roleInfo"></param>
        /// <returns></returns>
        public bool UpdateRoleInfo(RoleInfo roleInfo)
        {
            return _roleInfoDal.Update(roleInfo);
        }
    }
}
